<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>

<h3 style="padding-left: 20px;padding-top: 10px">
	<?=$data['name']?>——评委嘉宾<?php if($data['is_activity']==1){$column="activity";}else{$column="contest";}?>
	<a href="./index.php?m=contest&c=manage&a=init&is_activity=<?=$data['is_activity']?>" style="font-size:14px;color: #0000FF"><em>返回上一级</em></a>
</h3>

<div class="subnav">
	<div class="content-menu ib-a blue line-x">
		<a href="./index.php?m=contest&c=manage&a=view&id=<?=$id?>&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>" ><em><?php echo L($column)?>详情</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=award&a=init&id=<?=$id?>&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"><em><?php echo L($column)?>奖项</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=winner&a=init&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"><em><?php echo L($column)?>获奖</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=process&a=init&id=<?=$id?>&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"  ><em><?php echo L($column)?>流程</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=sign&a=init&id=<?=$id?>&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"   ><em>报名信息</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=contestant&a=init&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>" ><em>参赛者</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=sponsor&a=init&id=<?=$id?>&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"><em>相关单位</em></a>
		<span>|</span>
		<a href="./index.php?m=contest&c=guest&a=init&contest_id=<?=$id?>&is_activity=<?=$data['is_activity']?>"  class="on"><em>评委嘉宾</em></a>

	</div>
</div>

<div class="pad-lr-10">

	<form name="searchform" action="" method="get">
		<input type="hidden" value="contest" name="m">
		<input type="hidden" value="contestant" name="c">
		<input type="hidden" value="init" name="a">
		<input type="hidden" value="<?=$contest_id?>" name="contest_id">

		<table width="100%" cellspacing="0" class="search-form">
			<tbody>
			<tr>
				<td>
					<button type="button" style="float:right;margin-right:20px;margin-top:10px;" onclick="showAdd()" ><em>添加评委</em></button>
					<button type="button" style="float:right;margin-right:20px;margin-top:10px;" onclick="showAddGuest()" ><em>添加嘉宾</em></button>
					<button type="button" style="float:right;margin-right:20px;margin-top:10px;" onclick="showSelect()" ><em>选择嘉宾评委</em></button>
					<span style="clear: both"></span>
					<script>
						function showAdd(){
							window.top.art.dialog({
									id: 'add',
									iframe: '?m=contest&c=guest&a=add&contest_id=<?=$contest_id?>',
									title: '添加评委',
									width: '900',
									height: '500',
									lock: true
								},
								function() {
									var d = window.top.art.dialog({
										id: 'add'
									}).data.iframe;
									var form = d.document.getElementById('dosubmit');
									form.click();
									return false;
								},
								function() {
									window.top.art.dialog({
										id: 'add'
									}).close()
								});
						}


						function showAddGuest(){
							window.top.art.dialog({
									id: 'addGuest',
									iframe: '?m=contest&c=guest&a=addGuest&contest_id=<?=$contest_id?>',
									title: '添加嘉宾',
									width: '900',
									height: '500',
									lock: true
								},
								function() {
									var d = window.top.art.dialog({
										id: 'addGuest'
									}).data.iframe;
									var form = d.document.getElementById('dosubmit');
									form.click();
									return false;
								},
								function() {
									window.top.art.dialog({
										id: 'addGuest'
									}).close()
								});
						}


						function  showSelect(){
							window.top.art.dialog({
									id: 'select',
									iframe: '?m=contest&c=guest&a=bindTalent&contest_id=<?=$contest_id?>',
									title: '选择嘉宾评委',
									width: '900',
									height: '500',
									lock: true
								},
								function() {
									var d = window.top.art.dialog({
										id: 'select'
									}).data.iframe;
									var relation = d.document.getElementById('relation');
									if(relation.value!=""){
										$.ajax({
											type:"get",
											url:"?m=contest&c=guest&a=bindTalentAjax&contest_id=<?=$contest_id?>&relation="+relation.value+"&pc_hash=<?php echo $_SESSION['pc_hash'];?>",
											dataType: "json",
											success:function(data){
												if(data['status']){
													window.top.art.dialog({
														id: 'select'
													}).close()
													window.location.reload();
												}else{
													alert(data['msg']);
													return false;
												}
											}
										})
									}else{
										return true;
									}

								},
								function() {
									window.top.art.dialog({
										id: 'select'
									}).close()
								});
						}
					</script>

					<div class="explain-col">

						评委嘉宾姓名：
						<input name="keyword" type="text" value="<?php if(isset($_GET['keyword'])) {echo $_GET['keyword'];}?>"
							   class="input-text" />
						<input type="submit" name="search"  class="button" value="<?php echo L('search')?>" />
					</div>


				</td>
			</tr>
			</tbody>
		</table>
	</form>

	<form name="myform" action="?m=contest&c=guest&a=del" method="post"
		onsubmit="return confirm('<?php echo L('confirm')?>')">
		<div class="table-list">
			<table width="100%" cellspacing="0">
				<thead>
					<tr>
						<th align="left" width="20"><input type="checkbox" value=""
							id="check_box" onclick="selectall('id[]');"></th>
						<th align="left">ID</th>
						<th align="left"><?php echo L('contest_sign_name')?></th>
						<th align="left">类型</th>
						<th align="left"><?php echo '性别'?></th>
						<th align="left"><?php echo '年龄'?></th>
						<th align="left"><?php echo "人物图"?></th>
						<th align="left"><?php echo "上次编辑者"?></th>
						<th align="left"><?php echo L('contest_operation')?></th>
					</tr>
				</thead>
				<tbody>
<?php
if(!empty($contestinfo)){
foreach ($contestinfo as $k => $v) {
    ?>
    <tr>
		<td align="left"><input type="checkbox"
			value="<?php echo $v['cid']?>" name="id[]"></td>
		<td align="left"><?php echo $v['id']?></td>
		<td align="left"><?php echo $v['real_name']?></td>
		<td align="left"><?php if($v['ctype']==2){ echo "评委";}elseif($v['ctype']==3){ echo "嘉宾";}?></td>
		<td align="left"><?php  if(empty($v['gender'])){echo"<span style='color:red;'>（未设置）</span>";}else{if($v['gender']==1){echo '男';}elseif ($v['gender']==2){echo '女';}elseif($v['gender']==3){echo '保密';}}?></td>
		<td align="left"><?php if(empty($v['age'])){echo"<span style='color:red;'>（未设置）</span>";}else{echo $v['age'];}?></td>
		<td align="left"><?php if(!empty($v['image_square'])){?><img src="<?php echo $v['image_square'];?>" height="60"/><?php }else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
		<td align="left"><?php if(empty($v['publisher'])){echo"<span style='color:red;'>（未设置）</span>";}else{echo $v['publisher'];}?></td>
		<td align="left">
			<a href="?m=contest&c=guest&a=del&id=<?php echo $v['cid']?>"
			onClick="return confirm('<?php echo L('confirm')?>')">[<?php echo L('cancel_bind')?>]</a>

		</td>
	</tr>
<?php
}
}else{
    echo "<tr><td colspan='9' style='color:red;font-size:18px;text-align:center;'><span>暂无数据！</span></td></tr>";
}
?>
</tbody>
			</table>

			<div class="btn">
				<label for="check_box">
					<a href="#"
					onClick="javascript:$('input[type=checkbox]').attr('checked', true)"><?php echo L('select_all')?></a>/<a
					href="#"
					onClick="javascript:$('input[type=checkbox]').attr('checked', false)"><?php echo L('cancel')?></a></label>
				<input type="submit" class="button" name="dosubmit"
					value="<?php echo L('delete')?>" />
			</div>

			<div id="pages"><?php echo $pages?></div>
		</div>
	</form>
</div>

</body>
</html>